<template>
  <div>
    <div>编程式导航页面</div>
    <div>
      <a-button type="primary" @click="skip">跳转</a-button>
    </div>
    <p></p>
    <div>
      <a-button type="primary" @click="replacePath">替换</a-button>
    </div>
    <p></p>
    <div>
      <a-button type="primary" @click="goHistory">历史</a-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "ProgrammedNavigation",
  methods: {
    skip() {
      this.$router.push({path: '/RouterPage', query: {plan: 'private'}, hash: '#team'})
      /**
       * 注意如果提供了 path，params 会被忽略
       */
      // this.$router.push({name: 'RouterPage', params: {username: 'eduardo'}})
      /**
       *  我们可以手动建立 url
       */
      // const username = 'eduardo'
      // this.$router.push({path: `/RouterPage/${username}`})
    },
    replacePath() {
      this.$router.replace({path: '/RouterPage'})
    },
    goHistory() {
      this.$router.go(-1)
    }
  }
}
</script>

<style scoped>

</style>